package com.ruoyi.farmer.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.farmer.bo.countspe;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.farmer.mapper.VarietyMapper;
import com.ruoyi.farmer.domain.Variety;
import com.ruoyi.farmer.service.IVarietyService;

/**
 * 农产品品种  Service业务层处理
 *
 * @author 姚毫征
 * @date 2023-09-14
 */
@Service
public class VarietyServiceImpl implements IVarietyService
{
    @Autowired
    private VarietyMapper varietyMapper;

    /**
     * 查询农产品品种
     *
     * @param id 农产品品种  主键
     * @return 农产品品种
     */
    @Override
    public Variety selectVarietyById(Long id)
    {
        return varietyMapper.selectVarietyById(id);
    }

    /**
     * 查询农产品品种  列表
     *
     * @param variety 农产品品种
     * @return 农产品品种
     */
    @Override
    public List<Variety> selectVarietyList(Variety variety)
    {
        return varietyMapper.selectVarietyList(variety);
    }

    /**
     * 新增农产品品种
     *
     * @param variety 农产品品种
     * @return 结果
     */
    @Override
    public int insertVariety(Variety variety)
    {
        variety.setCreateTime(DateUtils.getTime());
        return varietyMapper.insertVariety(variety);
    }

    /**
     * 修改农产品品种
     *
     * @param variety 农产品品种
     * @return 结果
     */
    @Override
    public int updateVariety(Variety variety)
    {
        variety.setUpdateTime(DateUtils.getTime());
        return varietyMapper.updateVariety(variety);
    }

    /**
     * 批量删除农产品品种
     *
     * @param ids 需要删除的农产品品种  主键
     * @return 结果
     */
    @Override
    public int deleteVarietyByIds(Long[] ids)
    {
        return varietyMapper.deleteVarietyByIds(ids);
    }

    /**
     * 删除农产品品种  信息
     *
     * @param id 农产品品种  主键
     * @return 结果
     */
    @Override
    public int deleteVarietyById(Long id)
    {
        return varietyMapper.deleteVarietyById(id);
    }

    @Override
    public List<Variety> getAllVariety(String speciesId) {
        return varietyMapper.getAllVariety(speciesId);
    }

    @Override
    public List<countspe> getcountspe() {
        return varietyMapper.getcountspe();
    }
}
